package cn.wicking.proxy.dynamicProxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

public class ProxyInvocationHandler implements InvocationHandler {

    private Object object;

    public ProxyInvocationHandler(Object object) {
        this.object = object;
    }

    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        seeHouse();
        final Object invoke = method.invoke(object, args);
        fare();
        return invoke;
    }

    public void seeHouse(){
        System.out.println("看房！");
    }

    public void fare(){
        System.out.println("收中介费！");
    }


}